<?php
require_once("vcl/vcl.inc.php");
require_once("lib/db_connection.php");
//Includes
use_unit("forms.inc.php");
use_unit("extctrls.inc.php");
use_unit("stdctrls.inc.php");

//Class definition
class Route_Delete extends Page
{
       public $hiddenroute = null;
       public $hiddenEmp = null;
       function Route_DeleteCreate($sender, $params)
       {
       $emp = $_GET['emp'];
       $route = $_GET['route'];
       $this->hiddenEmp->setValue($emp);
       $this->hiddenroute->setValue($route);

       $result_route = mysql_query("delete from route_tbl where emp_id='".$this->hiddenEmp->getValue()."' and route_id='".$this->hiddenroute->getValue()."'");

       $result_job = mysql_query("DELETE FROM rou_jobrecord_tbl WHERE emp_id='".$this->hiddenEmp->getValue()."' and route_id='".$this->hiddenroute->getValue()."'") or die ('DELETE JOB - ' . mysql_error());

       $result_expense = mysql_query("DELETE FROM rou_expense_tbl WHERE emp_id='".$this->hiddenEmp->getValue()."' AND route_id='".$this->hiddenroute->getValue()."'") or die ('DELETE EXPENSE - ' . mysql_error());

       $result_fuel = mysql_query("DELETE FROM rou_fuel_tbl WHERE emp_id='".$this->hiddenEmp->getValue()."' AND route_id='".$this->hiddenroute->getValue()."'") or die ('DELETE FUEL - ' . mysql_error());

       redirect('route_list.php?emp='.$this->hiddenEmp->getValue().'&route='.$this->hiddenroute->getValue());


       }

}

global $application;

global $Route_Delete;

//Creates the form
$Route_Delete=new Route_Delete($application);

//Read from resource file
$Route_Delete->loadResource(__FILE__);

//Shows the form
$Route_Delete->show();

?>